package com.bawei.yangzongcai___day2.MVPActivity;

import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import android.view.View;
import com.bawei.mvp.View.BoosAcyivity;
import com.bawei.yangzongcai___day2.R;
import java.util.List;
public class MainActivity extends BoosAcyivity  implements  FoodContract.foodview{


    private RecyclerView review;

    @Override
    public int bandLayout() {
        return R.layout.activity_main;
    }

    @Override
    public void initView() {
        review = findViewById(R.id.review);
       review.setLayoutManager(new StaggeredGridLayoutManager(1,StaggeredGridLayoutManager.VERTICAL));
       //只要Acyivity执行就会触发MVP的Presenter层  Presenter再告诉Model层
        FoodPreter foodPreter = new FoodPreter(this, new FoodModel());
        //Model工作完成在提交给Presenter Presenter再交给View来展示
        foodPreter.getada();
    }

    @Override
    public void initDate() {
    }

    @Override
    public void showLayout() {
    }

    @Override
    public void haidLayout() {
    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
    }

    @Override
    public void initadapter(List<JavaMVP.DataBean> dataBeans) {
        //view展示数据
        BaseQuaireAdpter adpter = new BaseQuaireAdpter(dataBeans);
        review.setAdapter(adpter);
    }
}
